package com.ssy.lingxi.sms.api.common;

import com.ssy.lingxi.sms.api.model.response.MapResponse;

import java.util.ArrayList;
import java.util.List;

/**
 * 腾讯云配置项
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/6/11
 */
public enum TencentConfigEnum {

    appId("appId", "唯一标识"),
    secretId("secretId", "秘钥id"),
    secretKey("secretKey", "秘钥"),
    region("region", "产品所在的区"),
    sign("sign", "签名");

    private String code;
    private String message;

    TencentConfigEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static Boolean getMessage(String code){
        for (TencentConfigEnum e : TencentConfigEnum.values()) {
            if(code.equals(e.getCode())){
                return true;
            }
        }
        return false;
    }

    public static List<MapResponse> getCodes(){
        List<MapResponse> mapResponseList = new ArrayList<>();
        for (TencentConfigEnum e : TencentConfigEnum.values()) {
            MapResponse mapResponse = new MapResponse();
            mapResponse.setKey(e.getCode());
            mapResponse.setValue(e.getCode());
            mapResponseList.add(mapResponse);
        }
        return mapResponseList;
    }
}
